fun <T,R,U>((T)->R).addThen(next:(R)->U):(T)->U = 
    {input:T->next(this(input))}

fun increment(number:Int) :Double = number + 1.toDouble()
fun double(number:Double) = number*2

var incrementAndDouble = ::increment.addThen(::double)

println(incrementAndDouble(5))